<!DOCTYPE html>
<html >
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" href="/static/layui/css/layui.css"/>
    <script src="/static/js/jquery.js"></script>
    <script src="/static/layui/layui.js"></script>
</head>
<body>



<form class="layui-form" action="" id="form1">
     {% csrf_token %}
    <br>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">映像本地地址</label>
            <div class="layui-input-inline">
                <input type="text" name="file_path"  autocomplete="off" class="layui-input layui-disabled">
            </div>
        </div>
    </div>






</form>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" onclick="doSave()" class="layui-btn" >立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</div>

<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script inline="javascript">
    var projectData
     $.ajax({
        url:"/wyh0282/projectJson",    //请求的url地址
        dataType:"json",   //返回格式为json
        async:true,//请求是否异步，默认为异步，这也是ajax重要特性
        type:"GET",   //请求方式
        success:function(req){
            projectData = req.data
            for (var i = 0; i < projectData.length; i++){
                $('#projectId').append(new Option(projectData[i].name));// 下拉菜单里添加元素++

            }
            layui.form.render('select');
        },
        error:function(){
            alert("失败")
        }
    });

    var $,layer;
    layui.use(['form','laydate'],function (){

       var laydate = layui.laydate;
       $=layui.jquery;
       layer=layui.layer;

        //日期
        laydate.render({
            elem: '#date1'
        });
        laydate.render({
            elem: '#date'
        });



    })

    function doSave() {
       var requestData = $("#form1").serialize();
        $.post("/wyh0282/iamgUp1/",requestData,function (responseData) {
            if(responseData.code == 1){
               parent.layer.alert("上传映像成功！",{yes:function () {
                       parent.layer.closeAll();
                   }
               });
            }else {
                parent.layer.alert("上传映像失败！",{yes:function () {
                        parent.layer.closeAll();
                        window.parent.location.reload();
                    }
                });

            }




        });
    }

</script>

</body>
</html>